import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

Item {
    id: manualProcessBack
    width: 1820
    height: 980


    property real labelFontSize: 20

    // 当前子页码
    property int current_Child_Page: 1

    Component.onCompleted: {
        manualProcessLoader.source = "Manual_BasicControl.qml"
    }


    // Rectangle{      // 整体背景
    //     anchors.fill: parent
    //     color: "white"

    //     Text{
    //         anchors.centerIn: parent
    //         font.pixelSize: 50
    //         font.bold: true
    //         text: qsTr("手动加工界面")
    //     }
    // }

    Item{       // 顶部 位置速度信息显示栏
        width: 1820
        height: 160

        Rectangle{      // 背景色
            anchors.fill: parent
            color: "white"
        }

        Row{        // 标题栏
            Rectangle{      // 上料部分参数标题
                width: 490
                height: 160
                border.width: 3

                Row{
                    anchors.horizontalCenter: parent.horizontalCenter
                    spacing: 10
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("上料")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("位置")
                    }
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("速度")
                    }
                }

                Column{     // 上料部分参数标题
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 10

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("X0")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Y0")
                    }
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Z0")
                    }
                }

                Column{      // 上料位置显示
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 170

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("X0位置")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Y0位置")
                    }
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Z0位置")
                    }
                }

                Column{      // 上料速度显示
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 330

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("X0速度")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Y0速度")
                    }
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Z0速度")
                    }
                }

            }

            Rectangle{      // 钻铣部分参数标题
                width: 490
                height: 160
                border.width: 3

                Row{
                    anchors.horizontalCenter: parent.horizontalCenter
                    spacing: 10
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("钻铣")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("位置")
                    }
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("速度")
                    }
                }

                Column{     // 上料部分参数标题
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 10

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("X1")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Z1")
                    }
                }

                Column{      // 上料位置显示
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 170

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("X1位置")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Z1位置")
                    }
                }

                Column{      // 上料速度显示
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 330

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("X1速度")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("Z1速度")
                    }
                }

            }

            Rectangle{      // 锯切部分参数标题
                width: 490
                height: 160
                border.width: 3

                Row{
                    anchors.horizontalCenter: parent.horizontalCenter
                    spacing: 10
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("锯切")
                    }

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("位置")
                    }
                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        text: qsTr("速度")
                    }
                }


                Column{     // 上料部分参数标题
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 10

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("U0")
                    }
                }

                Column{      // 上料位置显示
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 170

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("U0位置")
                    }
                }

                Column{      // 上料速度显示
                    anchors.top: parent.top
                    anchors.topMargin: 40
                    anchors.left: parent.left
                    anchors.leftMargin: 330

                    A_Label{
                        labelWidth: 150
                        labelHeight: 40
                        bgColor: "transparent"
                        textColor: "black"
                        text: qsTr("U0速度")
                    }
                }

            }
        }

    }


    Item{       // 底部手动操作按钮
        anchors.top: manualProcessBack.top
        anchors.topMargin: 170
        width: 1820
        height: 810

        Rectangle{      // 背景色
            anchors.fill: parent
            color: "white"
        }

        Item{       // 底部中间 操作按钮
            width: 600
            height: 60
            anchors.horizontalCenter: parent.horizontalCenter

            Row{
                spacing: 10
                A_Button {
                    buttonWidth:150
                    buttonHeight: 40
                    contentText_Data:qsTr("基础操作")
                    isSelected: current_Child_Page === 1
                    onButtonClicked: {
                        current_Child_Page = 1
                        manualProcessLoader.source = "Manual_BasicControl.qml"
                    }
                }
                A_Button {
                    buttonWidth:150
                    buttonHeight: 40
                    contentText_Data:qsTr("气缸")
                    isSelected: current_Child_Page === 2
                    onButtonClicked: {
                        current_Child_Page = 2
                        manualProcessLoader.source = "Manual_Air_Cylinder.qml"
                    }
                }
                A_Button {
                    buttonWidth:150
                    buttonHeight: 40
                    contentText_Data:qsTr("回原")
                    isSelected: current_Child_Page === 3
                    onButtonClicked: {
                        current_Child_Page = 3
                        manualProcessLoader.source = "Manual_Return_Zero.qml"
                    }
                }
                A_Button {
                    buttonWidth:150
                    buttonHeight: 40
                    contentText_Data:qsTr("标定")
                    isSelected: current_Child_Page === 4
                    onButtonClicked: {
                        current_Child_Page = 4
                        manualProcessLoader.source = "Manual_Calibration.qml"
                    }
                }
            }
        }
    }


    Loader{
        id: manualProcessLoader
        anchors.top: manualProcessBack.top
        anchors.topMargin: 220
        anchors.left: manualProcessBack.left
        anchors.leftMargin: 10
        onSourceChanged: {
            console.log("已加载: "+ source)
        }
    }





}
